<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="path" value="${pageContext.request.contextPath}"/>

<!DOCTYPE html>
<html>
<head>
<base href="${path}/pages/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>个人博客后台管理</title>
<link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body>
	
<div class="layui-fluid">
	<div class="layui-form" style="margin-top: 10px">
		<input type="hidden" name="notice_id" value="${notice.notice_id}">
  
  		<div class="layui-form-item layui-form-text">
    		<label class="layui-form-label">公告内容</label>
    		<div class="layui-input-block">
      			<textarea name="notice_content" id="content" style="display:none;" placeholder="请输入内容"lay-verify="required"  class="layui-textarea">${notice.notice_content}</textarea>
    		</div>
  		</div>
  	   	<div class="layui-form-item">
    		<label class="layui-form-label">状态</label>
    		<div class="layui-input-block">
				<input type="checkbox" name="statu" lay-skin="switch" <c:if test="${notice.status}==1">checked</c:if> lay-text="发布|暂存">
    		</div>
  		</div>
  			
  

  		<div class="layui-form-item layui-hide">
	      	<input type="button" lay-submit lay-filter="lay-form-submit" id="lay-form-submit">
	    </div>
  	</div>
  
  	<script src="${path }/layui/layui.js"></script>
	<script>
	layui.use(['form','element','layedit'], function(){
		var form = layui.form;
		var $ = layui.$;
		var layedit=layui.layedit;
		  var element = layui.element;
		 	
		
  		var editIdx = layedit.build('content');
		//监听提交
    	form.on('submit(lay-form-submit)', function(data) {
    		data.field.notice_content = layedit.getContent(editIdx);

      		var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引  
      		//提交ajax成功后，关闭当前弹层并重载表格
      		$.post('${path}/action/notice/save', data.field, function(json) {
      				parent.layui.table.reload('lay-table'); //重载表格
      	      		parent.layer.close(index); //再执行关闭      				
      			}, 'JSON');
    	});
		
	});	
	
	</script>
</div>

</body>
</html>
